version: '3.8'

services:
  nginx:
    image: docker.io/nginx:latest
    ports:
      - "5000:443"
    volumes: 
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./certs:/etc/ssl/certs
    networks:
      - frontend
      - backend
    depends_on:
      - Flask
    restart: always

  Flask:
    image: docker.io/hassiy/flask:3.0.3
    environment:
      - FLASK_ENV=development
    networks:
      - backend
    deploy:
      replicas: 3
      update_config:
        parallelism: 2
        delay: 5s
    restart: always

networks:
  frontend:
    external: true
  backend:
    internal: true
